package it.polimi.jita.cp.block;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.apache.commons.cli2.Option;
import org.apache.commons.cli2.option.Command;

public class InputBuilderRegister {

	private Map<Option, Class<? extends InputBuilder<?>>> map = new HashMap<>();

	protected void registerOption(Option option,
			Class<? extends InputBuilder<?>> inputBuilderClass) {
		map.put(option, inputBuilderClass);
	}

	protected InputBuilder<?> getInputBuilder(Command command)
			throws InstantiationException, IllegalAccessException {
		InputBuilder<?> ib = (InputBuilder<?>) map.get(command).newInstance();
		ib.setCommand(command);
		return ib;
	}
	
	protected Set<Option> getOptions(){
		return map.keySet();
	}

}
